<template>
	<view class="goods-item">
	  <!-- 左侧 -->
	  <view class="left-item">
      <!-- <radio checked color="#f80"></radio> -->
      <!-- 插槽 -->
      <slot name="radio"></slot>
	    <image :src="goods.goods_small_logo || defaultPic" class="goods-pic"></image>
	  </view>
	  <!-- 右侧 -->
	  <view class="right-item">
	    <!-- 商品名字 -->
	    <view class="goods-name">
	      {{goods.goods_name}}
	    </view>
	    <!-- 商品信息 -->
	    <view class="goods-info-box">
	      <view class="goods-price">￥{{goods.goods_price | tofixed}}</view>
        <slot name="numbox"></slot>
	    </view>
	  </view>
	</view>
</template>
<script>
  export default{
    name:'my-goods',
    props:{
      goods:{
        type:Object,
        default:{}
      }
    },
    data(){
      return{
        // 默认的空图片
        defaultPic: 'https://img3.doubanio.com/f/movie/8dd0c794499fe925ae2ae89ee30cd225750457b4/pics/movie/celebrity-default-medium.png'
      }
    },
    filters:{
      tofixed(num){
        return num.toFixed(2)
      }
    }
  }
</script>
<style lang="scss">
  .goods-item{
    display: flex;
    padding: 10px 5px;
    border-bottom: 1px solid #eee;
    width: 750rpx;
    box-sizing: border-box;
    .left-item{
      margin-right: 5px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .goods-pic{
        width: 100px;
        height: 100px;
        display: block;
      }
    }
    
    .right-item{
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      flex: 1;
      .goods-name{
        font-size: 13px;
      }
      .goods-info-box{
        display: flex;
        justify-content: space-between;
        align-items: center;
        .goods-price{
          color: #c00000;
        }
      }
    }
  }
</style>
